
import { Component } from 'react';

import { Button } from 'antd';

import ds from '@/datasource.js';

class BlogPost extends Component {
    constructor(props){
        super(props);
        this.state = {
            post: props.data
        }
    }
    render(){
        const { title , desc , id }= this.state.post;
        return (
            <div className="blog-post">
                <h3>{ title}</h3>
                <p>{ desc }</p>
                <Button type="primary" onClick={ () => ds.setBlogPost( id ) }>修改</Button>
            </div>
        )
    }
}

export default BlogPost ;